from django.http import HttpResponse
from django.shortcuts import render
from vro import models
import random

mess_list = [
    '後輩ちゃんくそやろうやで',
    'やってやろうじゃねぇかよこの野郎！',
    '＊＊から、＄＄が出へん'
]

son_list = {
    '554': 'あかり',
    '1206': 'ゆかり',
    '1208': 'セイカ',
    '1205': 'マキ',
    '1202': 'ずん子',
    '1209': 'きりたん',
    '552': '茜',
    '551': '葵',
    '2006': 'ウナ'
# 以后也差不多得了，应该干点正事了，用爬虫爬别人的东西算什么本事？
}


# Create your views here.
def add_mess(request):
    text = request.GET.get('text')
    cha = request.GET.get('speaker_id')

    ip = request.META.get('REMOTE_ADDR')

    v = models.Vmess()
    v.charactor = son_list[str(cha)]
    v.sentence = text
    v.ip = ip
    v.save()

    return HttpResponse('successfully!')


def get_mess(request):
    mess = models.Vmess.objects.all()

    return render(request, 'h.html', context={'mess': mess})
